import type { MockMethod } from 'vite-plugin-mock'
import Mock from "mockjs"
export default [
    // 拦截获取天气图片查询表的请求
    {
        url: '/api/origin/list',
        method: 'get',
        response: () => {
            const originList = Mock.mock({
                "data|4": [    //生成4条数据
                    {
                        "id|+1": 1,
                        time: "@datetime",
                        title: "@cword(4,6)",
                        img: "https://ts2.tc.mm.bing.net/th/id/OIP-C.8qI8Z9lUf_8GJ87HqDP_qwHaFS?rs=1&pid=ImgDetMain&o=7&rm=3",
                        "tags|2000-5000": 3000,
                        from:'大栗子种植基地',
                        address:'北京市海淀区高丽张路大栗子种植基地333号',
                        farmer:'大狸子',
                        link:'http://www.dalizizhongzhijidi.com',
                        testPerson:'小狸子'
                    }
                ]
            })
            return {
                code: 0,
                msg: 'ok',
                // 1表示成功，非1为失败
                data: {
                    ...originList,
                }
            }
        }
    },
    {
        url: '/api/origin/add',
        method: 'post',
        response: () => {
            return {
                code: 0,
                msg: 'ok',
                data: {
                    message: '提交成功',
                    "originLength|1-5": 1
                }
            }
        }
    },
    {
        url: '/api/origin/delete/:id',
        method: 'delete',
        response: () => {
            return {
                code: 0,
                msg: 'ok',
                data: {
                    message: '删除成功',
                    "originLength|1-5": 1
                }
            }
        }
    }
] as MockMethod[]